-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
built out rough input parser taking basic yes no commands, as well as… #13
Conversation
… the command move
This is a start to the issue for #3 . I felt that by bringing in a starting place for I/O, it might help get the juices flowing for everyone. Feel free to change the implementation. This is certainly incomplete. |
pub static VALID_NEGATIVE_RESPONSES: [&str; 2] = ["no", "n"]; | ||
static VALID_ACTIONS: [&str; 1] = ["move"]; | ||
|
||
pub fn get_valid_response(input: String) -> (String, bool) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are awesome helper funcs, I like the way it's organized
mod story_manager; | ||
use story_manager::{introduction, tutorial}; | ||
mod user_command; | ||
|
||
fn main() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love how this is organized and modular too 👌
|
||
let mut buffer = String::with_capacity(2048); | ||
// Lock our standard input to eliminate synchronization overhead (unlocks when dropped) | ||
let mut stdin = io::stdin().lock(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious about this, and maybe I just haven't learned enough about Rust yet, but -
line 40 defines an immutable variable, right? but then line 44 defines the same variable name, but mutable, so is this still a "shadow" variable since the first one was supposed to be immutable?
… the command move